package rus.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;


@Entity
@Table(name="product_category")
public class ProductCategory implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 5573194169356013593L;
	
	private Integer id;
	private String name;
	private ContentImage image;
	private List<Product> productList;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public Integer getId() {
		return id;
	}
	
	@Column(name="name")
	public String getName() {
		return name;
	}
	
	@OneToMany
	@JoinColumn(name="product_list")
	public List<Product> getProductList() {
		return productList;
	}
	
	public void setId(Integer id) {
		this.id = id;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setProductList(List<Product> productList) {
		this.productList = productList;
	}

	public void setImage(ContentImage image) {
		this.image = image;
	}
	
	@ManyToOne
	@JoinColumn(nullable=true)
	public ContentImage getImage() {
		return image;
	}

}
